#ifndef WALKAWARE_SHARED_RAWDEPTHMAP_H
#define WALKAWARE_SHARED_RAWDEPTHMAP_H

#include <QSharedDataPointer>
#include <QMetaType>

#include <WalkaWare/Shared/Detail/RawDepthMapPrivate.h>

namespace WalkaWare
{

namespace Shared
{

class RawDepthMap
{
	public:

		typedef void        BaseType;
		typedef RawDepthMap ThisType;

		RawDepthMap(void)
		{
			this->d = new Detail::RawDepthMapPrivate();
		}

		RawDepthMap(const ThisType & other)
			: d(other.d)
		{
			;
		}

		RawDepthMap(int width, int height, const quint16 * data = 0)
		{
			this->d = new Detail::RawDepthMapPrivate(width, height, data);
		}

		void setup(int width, int height, const quint16 * data = 0)
		{
			this->d->setup(width, height, data);
		}

		void clear(void)
		{
			this->d->clear();
		}

		void fill(quint16 value = 0)
		{
			this->d->fill(value);
		}

		int width(void) const
		{
			return this->d->width();
		}

		int height(void) const
		{
			return this->d->height();
		}

		int size(void) const
		{
			return this->d->size();
		}

		bool isEmpty(void) const
		{
			return this->d->isEmpty();
		}

		const QVector<quint16> & data(void) const
		{
			return this->d->data();
		}

		QVector<quint16> & data(void)
		{
			return this->d->data();
		}

		int indexOf(int x, int y) const
		{
			return this->d->indexOf(x, y);
		}

		quint16 at(int x, int y) const
		{
			return this->d->at(x, y);
		}

		quint16 & at(int x, int y)
		{
			return this->d->at(x, y);
		}

		quint16 operator () (int x, int y) const
		{
			return (*(this->d))(x, y);
		}

		quint16 & operator () (int x, int y)
		{
			return (*(this->d))(x, y);
		}

	protected:

		 QSharedDataPointer<Detail::RawDepthMapPrivate> d;
};

} // end namespace Shared

} // end namespace WalkaWare

Q_DECLARE_METATYPE(WalkaWare::Shared::RawDepthMap)

#endif // WALKAWARE_SHARED_RAWDEPTHMAP_H
